package com.flyoil.petromp.mvp_p.ListPresenter;

import com.flyoil.petromp.base.BaseModel;
import com.flyoil.petromp.mvp_m.CourseListModel.CourseFinanceListModel;
import com.flyoil.petromp.mvp_m.CourseListModel.GoodsApproveListModel;
import com.flyoil.petromp.mvp_m.CourseListModel.GoodsDateExamineListModel;
import com.flyoil.petromp.mvp_m.CourseListModel.GoodsDemandListModel;
import com.flyoil.petromp.mvp_m.CourseListModel.GoodsExamineListModel;
import com.flyoil.petromp.mvp_m.CourseListModel.GoodsOrderListModel;
import com.flyoil.petromp.mvp_m.CourseListModel.CoursePlanListModel;
import com.flyoil.petromp.mvp_m.CourseListModel.ServiceApproveListModel;
import com.flyoil.petromp.mvp_m.CourseListModel.ServiceDemandListModel;
import com.flyoil.petromp.mvp_m.CourseListModel.ServiceExamineListModel;
import com.flyoil.petromp.mvp_m.CourseListModel.ServiceOrderListModel;
import com.flyoil.petromp.mvp_p.Listener.BasePresenter;
import com.flyoil.petromp.mvp_v.ListUIView.BaseUIView;
import com.flyoil.petromp.utils.OrderUtl.OrderListUtil;

import java.util.List;
import java.util.Map;

/**
 * Created by songzhiyin on 2017/10/31.
 * 流程列表的数据ui逻辑处理类
 */

public class CourseCertainListPresenter implements BasePresenter {
    private BaseUIView uiView;
    private BaseModel model;
    private String type;

    public CourseCertainListPresenter(BaseUIView baseUIView, String type) {
        this.uiView = baseUIView;
        this.type = type;
        model = new CoursePlanListModel();
        initModel();
    }

    @Override
    public void initNetworkData(Map<String, Object> map) {
        model.loadNetworkData(map, this);
    }


    @Override
    public void onsucced(List data) {
        uiView.updataToUI(data);
    }

    private void initModel() {

        switch (type) {
            case OrderListUtil.PLAN:
                model = new CoursePlanListModel();
                break;
            case OrderListUtil.GOODS_DEMAND:
                model = new GoodsDemandListModel();
                break;
            case OrderListUtil.GOODS_APPROVE:
                model = new GoodsApproveListModel();
                break;
            case OrderListUtil.GOODS_ORDER:
                model = new GoodsOrderListModel();
                break;
            case OrderListUtil.GOODS_EXAMINE:
                model = new GoodsExamineListModel();
                break;
            case OrderListUtil.GOODS_DATE_EXAMINE:
                model = new GoodsDateExamineListModel();
                break;
            case OrderListUtil.SERVICE_DEMAND:
                model = new ServiceDemandListModel();
                break;
            case OrderListUtil.SERVICE_APPROVE:
                model = new ServiceApproveListModel();
                break;
            case OrderListUtil.SERVICE_ORDER:
                model = new ServiceOrderListModel();
                break;
            case OrderListUtil.SERVICE_EXAMINE:
                model = new ServiceExamineListModel();
                break;
            case OrderListUtil.FINANCE:
                model = new CourseFinanceListModel();
                break;
        }
    }

}
